window.onload=function(){
	myfun1();
function myfun1(){	
	var n=0;
	var img=document.getElementsByClassName('img')[0].children;
	var circle=document.getElementsByClassName('circle')[0].children;
	var font=document.getElementsByClassName('font')[0].children;
	var left=document.getElementsByClassName('left')[0];
	var right=document.getElementsByClassName('right')[0];
	var lr=document.getElementsByClassName('font')[0].getElementsByTagName('span');
	// console.log(lr);
	var mytime=setInterval(run,3000);
	function run(){
		n++;
		if (n>=img.length) {
			n=0;
		}
		myfor();
		img[n].style.opacity="1";
		circle[n].style.opacity="1";      
		// font[n].style.opacity="1";
		mytime2();
	}
	for (var i = circle.length - 1; i >= 0; i--) {
		circle[i].n=i;
		circle[i].onclick=function(){
			myfor();
			this.style.opacity="1";
			img[this.n].style.opacity="1";
			// font[this.n].style.opacity="1";
			mytime3();
			n=this.n;
		}
		circle[i].onmouseover=function(){
			clearInterval(mytime);
		}
		circle[i].onmouseleave=function(){
			mytime=setInterval(run,3000);
		}
	}
	for (var i = lr.length - 1; i >= 0; i--) {
		lr[i].onmouseover=function(){
			clearInterval(mytime);
		}
		lr[i].onmouseout=function(){
			mytime=setInterval(run,3000);
		}
	}
	left.onclick=function(){
		n--;
		if (n<0) {
			n=img.length-1;
		}
		myfor();
		img[n].style.opacity="1";
		circle[n].style.opacity="1";
		// font[n].style.opacity="1";
		mytime2();

	}
	right.onclick=function(){
		n++;
		if (n>img.length-1) {
			n=0;
		}
		myfor();
		img[n].style.opacity="1";
		circle[n].style.opacity="1";
		// font[n].style.opacity="1";
		mytime2();
	}
	function myfor(){
		for (var i = img.length - 1; i >= 0; i--) {
			img[i].style.opacity="0";
			circle[i].style.opacity="0.5";
			font[i].style.opacity="0";
		}
	}

	function mytime2(){
		setTimeout(function(){
			font[n].style.opacity='1';
		},1000)
	}
	function mytime3(){
		setTimeout(function(){
			font[this.n].style.opacity='1';
		},1000)
	}


	}
// 第二段
	myfun2("box1",1);
    function myfun2(id,z){
    var box=document.getElementById(id);
	var lunbo1=box.getElementsByClassName('lunbo');
	var jt=box.getElementsByClassName('lunbo1_jt');
	var bt=box.getElementsByClassName('box1_bt');
	var n=0;
	var arr=[0,0,0];
	if(z==1){
	for (var i = bt.length - 1; i >= 0; i--) {
		bt[i].n=i;
		bt[i].onclick=function(){
			var m=Number(arr[this.n]);
				for (var i = jt.length - 1; i >= 0; i--) {
					jt[i].style.display="block";
				}
				if(m==0){
					jt[0].style.display="none";
				}else{
					jt[1].style.display="none";
				}
			
					// console.log(arr);
				if(this.n==0){
				n=this.n;
				for (var i = bt.length - 1; i >= 0; i--) {
					bt[i].style.color='#656565';
					this.style.color="black";
					lunbo1[i].style.display='none';
					lunbo1[this.n].style.display="block";
					
				}
			}else{
				n=this.n;
				for (var i = bt.length - 1; i >= 0; i--) {
					bt[i].style.color='#656565';
					this.style.color="black";
					lunbo1[i].style.display='none';
					lunbo1[this.n].style.display="block";
				}

			}
		}
		
	}
	}
	for (var i = jt.length - 1; i >= 0; i--) {
		jt[i].n=i;
		jt[i].onclick=function(){
			if(this.n==0){
				lunbo1[n].style.transform='translateX(0px)';
				arr.splice(n,1,0);
				for (var i = jt.length - 1; i >= 0; i--) {
					jt[i].style.display='block';
				}
				this.style.display='none';
			}else{
				lunbo1[n].style.transform='translateX(-964px)';
				arr.splice(n,1,1);
				for (var i = jt.length - 1; i >= 0; i--) {
					jt[i].style.display='block';
				}
				this.style.display='none';
			}
			console.log(arr);
		}
	}
	}
myfun2("box3",1);
myfun3();
function myfun3(){
	var jt=document.getElementsByClassName("box2_jt");
	var lunbo=document.getElementsByClassName("lunbo3")[0];
	// console.log(jt);
	for (var i = jt.length - 1; i >= 0; i--) {
		jt[i].n=i;
		jt[i].onclick=function(){
			if (this.n==0) {
				lunbo.style.transform='translateX(0px)';
				for (var i = jt.length - 1; i >= 0; i--) {
					jt[i].style.display='block';
				}
				this.style.display='none';
			}else{
				lunbo.style.transform='translateX(-964px)';
				for (var i = jt.length - 1; i >= 0; i--) {
					jt[i].style.display='block';
				}
				this.style.display='none';
			}
		}
	}
}
myfun4();
function myfun4(){
	var shiguang=document.getElementById('shiguang');
	var tubiao=document.getElementById('tubiao');
	var search=document.getElementsByClassName('head_search')[0];
	var ipt=document.getElementById('head_ipt');
	var img=document.getElementsByClassName('img_search')[0];
	var imgg=document.getElementById('img_search_img');
	var n=2;
	console.log(tubiao);
	tubiao.onclick=function(){
		n++;
		if(n%2==1){
		this.style.backgroundPosition='-95px -44px';
		search.style.display="block";
		shiguang.style.display="none";
		img.style.background="";
		}else{
			this.style.backgroundPosition='-74px -44px';
			search.style.display="none";
			shiguang.style.display="block";
		}
	}
	ipt.onclick=function(){
		img.style.background="#1e7dd7";
		imgg.style.backgroundPosition="-134px -45px";
	}
}

}